<!--
 * @Descripttion : 
 * @Autor        : Lilong
 * @Date         : 2022-09-07 15:02:07
 * @LastEditTime : 2022-09-08 15:46:14
 * @FilePath     : \侦听器\watch\组合式API用法\侦听多个数据源\监听多个响应式数据数据\APP.vue
-->
<template>
  <div>
    <div>{{obj.name}}</div>
    <div>{{obj.age}}</div>
    <div>{{count}}</div>
    <button @click="changeName">改变值</button>
  </div>
</template>

<script>
import { reactive, ref, watch } from 'vue';
export default {
  setup(){
    const count = ref(0);
    const obj = reactive({
      name:'zs',
      age:14
    });
    const changeName = () => {
      obj.name = 'ls';
    };
    watch([count,obj],([count, obj], [prevCount, prevObj]) => {
      console.log('监听的多个数据改变了')
    })
    return {
      obj,
      count,
      changeName,
    }
  }
}
</script>